On Object Layout for Multiple Inheritance

نویسندگان

  • William Pugh
  • Grant E Weddell
چکیده

We consider the problem of encoding objects for object oriented programming languages that allow subtyping and multiple inheritance among class de nitions This is an important problem since a choice of encoding will determine the implementation for a number of common operations extracting a property value from an object comparing two object references for equality and expression retyping We expand on earlier work in in which we proposed a new algorithm for obtaining an object encoding that assigns a xed o set to each property This allows property values to be extracted with the same e ciency as in systems that do not provide multiple inheritance We present both analytic and experimental evidence that suggests that this is an important performance issue and that our method works well in practice Index Terms object oriented programming languages object encoding compilation On Object Layout for Multiple Inheritance Introduction Recently developed type systems for polymorphic programming languages allow a user to organize a description of objects in terms of a generalization taxonomy of class types In this paper we expand on earlier work in that proposed a new algorithm for obtaining an object layout in cases where multiple inheritance occurs in the taxonomy We propose a new algorithm that generalizes earlier approaches based on the idea of conversion to single inheritance of table lookup and a two directional algorithm in The choice of object encoding is important since it determines how property values are extracted from objects how object references are compared for equality and how to retype expressions at runtime Determining a choice of behavior for an object reduces to the problem of extracting property values from an associated class object so procedures for obtaining an object encoding may also be used to implement method dispatch We begin in the next section with a simple example to help motivate the results of this paper Section that follows is a survey of previous work on the problem of nding an object encoding This includes a review of the procedures used to implement multiple inheritance in Smalltalk and in C We base our review on a simple type de nition language introduced at the start of the section in which both class and record types may be de ned Instances of the former constitute a logical or conceptual view of a collection of objects while instances of the latter specify how objects are actually encoded in memory Our main results follow in Section in which we present a new algorithm for obtaining an object encoding The algorithm incorporates a generalized version of Algorithm B in and can produce an object encoding in which each property is assigned a xed o set We demonstrate that the main advantage of this is that property value access can proceed with the same e ciency as in systems that do not provide multiple inheritance Our analytic and experimental results further con rm that the method works well in practice and that the e ciency of the method itself will not be a problem for cases involving class types likely to occur in practice In our summary comments in Section we discuss a number of remaining issues and suggest some future directions of research Part of discussion focuses on the issue of interactive use and separate compilation We stated above that the object encoding problem is an important performance issue In support of this claim we refer the reader to which outlines an experiment performed on a C compiler The results of the experiment indicate that the means of property value extraction alone can signi cantly a ect overall performance of the compiler This suggests that the object layout problem is an important performance issue for software systems with components that require the extensive manipulation of memory resident data Note that this is not the case if the data resides

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Space- and Time-Efficient Object Layout for Multiple Inheritance

Traditional implementations of multiple inheritance bring about not only an overhead in terms of run time but also a significant increase in object space. For example, in a hierarchy of classes, the number of compiler generated fields in certain objects can be as large as quadratic in . The problem of efficient object layout is compounded by the need to support two different semantics of multip...

متن کامل

Empirical Study of Object-Layout Strategies and Optimization Techniques

Although there is a large body of research on the time overhead of object oriented programs, there is little work on memory overhead. This paper takes an empirical approach to the study of this overhead, which turns out to be significant in the presence of multiple inheritance. We study the performance, in terms of overhead to object size of three compilation strategies: separate compilation, w...

متن کامل

Machine-checked object layout for C++ multiple inheritance with empty-base optimization

We also adopt the following additional notations: • rst is a function de ned on non-empty lists, such that rst(a :: l′) def. a for all a, l′. • last is a function de ned on non-empty lists, computing their last elements: last(a :: nil) def. a and last(a :: b :: l′) def. last(b :: l′) for all a, b, l′. • length(l) is the length of a list l: length(nil) def. 0 and length(a :: l′) def. 1 + length(...

متن کامل

SJS: A Type System for JavaScript with Fixed Object Layout

We propose a static type system for a significant subset of JavaScript, dubbed SJS, with the goal of ensuring that objects have a statically known layout at the allocation time, which in turn can enable an ahead-of-time (AOT) compiler to generate efficient code. The main technical challenge we address is to ensure fixed object layout, while supporting popular language features such as objects w...

متن کامل

Mechanized Formal Semantics and Veri ed Compilation for C++ Objects

C++ is one of the most widely used programming languages in practice, including for embedded critical software. Thus, it becomes interesting to apply formal methods to programs written in C++. To this end, it is necessary to rely on a formal semantics of C++. Moreover, such a formal semantics can be validated as a basis to the speci cation and proof of a veri ed realistic compiler for C++ to ga...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2002